#!/bin/bash
INIT_FILE_NAME="init.lock"
PROGRAM_CATALOG="vendors"
# whether exist init file.
if [[ -f ${INIT_FILE_NAME} ]]; then
    echo -e "again start ~"
    cd ${PROGRAM_CATALOG}
    npm install --registry=https://registry.npm.taobao.org
else
    echo -e "init start ~"
    cd ${PROGRAM_CATALOG}
    npm install --registry=https://registry.npm.taobao.org
    # init admin user.
    npm run install-server
fi
# start before install.
node server/app.js
